package com.mijie.tag;

import java.io.File;
import java.io.IOException;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.SimpleTagSupport;

import com.mijie.core.ApplicationProperties;

public class ImageTag extends SimpleTagSupport{

	private String propKey;
	private String picName;
	
	public void doTag() throws JspException, IOException {
		JspWriter out = getJspContext().getOut();
		String url = ApplicationProperties.get(propKey);
		if(url!=null){
			if(!url.endsWith(File.separator)) url += File.separator;
			out.write("<img src='"+url+picName+"'/>");
		}
	}

	public void setPropKey(String propKey) {
		this.propKey = propKey;
	}

	public void setPicName(String picName) {
		this.picName = picName;
	}

}
